/*
 * Created on Oct 26, 2004
 *
 * To change the template for this generated file go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
package com.erclab.internal.xpresso.conf;

import java.util.PropertyResourceBundle;

import com.erclab.internal.xpresso.cache.CacheManager;
import com.erclab.internal.xpresso.lang.LanguageHandler;
import com.erclab.internal.xpresso.repositories.*;
import com.erclab.internal.xpresso.security.AccessController;
import com.erclab.internal.xpresso.security.UserDirectory;
import com.erclab.internal.xpresso.util.ObjectCreator;


/**
 * @author rodrigen
 *
 */
public class Settings {
	
	protected static Repository repository;
	protected static UserDirectory userDirectory;
	protected static AccessController accessController;
	protected static LanguageHandler languageHandler;
	protected static ObjectCreator objectCreator;
	protected static int directoryIdDataSource;
	protected static boolean adminMode;
	protected static PropertyResourceBundle properties;
	protected static CacheManager cacheManager;
	
	public static void setRepository(Repository r){
		repository = r;
	}
	
	public static Repository getRepository(){
		return repository;
	}

	/**
	 * @return
	 */
	public static int getDirectoryIdDataSource() {
		return directoryIdDataSource;
	}

	/**
	 * @param i
	 */
	public static void setDirectoryIdDataSource(int i) {
		directoryIdDataSource = i;
	}


	/**
	 * @return
	 */
	public static AccessController getAccessController() {
		return accessController;
	}


	/**
	 * @param controller
	 */
	public static void setAccessController(AccessController controller) {
		accessController = controller;
	}



	/**
	 * @return
	 */
	public static UserDirectory getUserDirectory() {
		return userDirectory;
	}

	/**
	 * @param directory
	 */
	public static void setUserDirectory(UserDirectory directory) {
		userDirectory = directory;
	}

	/**
	 * @param string
	 */
	public static void setAdminMode(String setup) {
		adminMode = (new Boolean(setup)).booleanValue();		
	}
	
	public static boolean getAdminMode(){
		return adminMode;
	}

	public static void setProperties(PropertyResourceBundle bundle) {
		properties = bundle;
	}
	
	public static String getProperty(String propertyName){
		return (String)properties.handleGetObject(propertyName);
	}

	public static LanguageHandler getLanguageHandler() {
		return languageHandler;
	}

	public static void setLanguageHandler(LanguageHandler languageHandler) {
		Settings.languageHandler = languageHandler;
	}

	public static ObjectCreator getObjectCreator() {
		return objectCreator;
	}

	public static void setObjectCreator(ObjectCreator objectCreator) {
		Settings.objectCreator = objectCreator;
	}

	public static CacheManager getCacheManager() {
		return cacheManager;
	}

	public static void setCacheManager(CacheManager cacheManager) {
		Settings.cacheManager = cacheManager;
	}

}
